package com.zhai.boot.domain.es;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhai.boot.common.EsConstant;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author Created by 翟凤玺
 * @package com.zhai.boot.domain.es
 * @project-name zhai-boot
 * @description 交易记录
 * @create-datetime 2020-5-8 09:46
 */
@Data
@Accessors(chain = true)
@Document(indexName = EsConstant.INDEX_DEAL, type = EsConstant.TYPE_DEAL)
public class DealEs {

    @Id
    private String serialNum;

    @Field(type = FieldType.Keyword)
    private String account;

    private BigDecimal amount;

    /** ik_max_word：ik分词器 */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String remark;

    @Field(type = FieldType.Date)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}